import 'dart:convert';

import 'package:json_annotation/json_annotation.dart';

part 'AppWSMessage.g.dart';

@JsonSerializable()
class AppWSMessage {
  String? type;
  String? data;

  AppWSMessage();

  AppWSMessage.create(this.type, this.data);

  Map<String, dynamic> toJson() {
    return _$AppWSMessageToJson(this);
  }

  String toJsonStr() {
    return jsonEncode(toJson());
  }

  static AppWSMessage fromJson(Map<String, dynamic> json) {
    return _$AppWSMessageFromJson(json);
  }

  @override
  String toString() {
    return 'AppWSMessage{type: $type, data: $data}';
  }
}
